﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace BarManager.Core.Entity
{
    [DataContract]
    public class Empleado : Persona
    {
        [Required]
        [DataMember]
        public int CargoId { get; set; }

        [Required]
        [DataType(DataType.Date)]
        [Display(Name = "Fecha de Alta")]
        [DataMember]
        public DateTime FechaAlta { get; set; }

        [DataType(DataType.Date)]
        [Display(Name = "Fecha de Baja")]
        [DataMember]
        public DateTime? FechaBaja { get; set; }

        [DataMember]
        public virtual Cargo Cargo { get; set; }

        [DataMember]
        [RegularExpression(@"^([0-9]*\,?[0-9]+|[0-9]+\,?[0-9]*)?$",
           ErrorMessage = "Remun. por Hora invalida (0,00)")]
        [Display(Name = "Remuneración por Hora")]
        [DataType(DataType.Currency)]
        public decimal? RemuneracionPorHora { get; set; }

        [DataMember]
        [Display(Name = "Tiene comisión por Vta.")]
        public bool TieneComisionPorVenta { get; set; }

        [DataMember]
        [RegularExpression(@"^\d{1,2}(\,\d{1,2})?$",
           ErrorMessage = "Porc. comisión por vta. invalida (0,01 a 99,99)")]        
        [Display(Name = "Comisión por Vta.")]        
        public decimal? PorcentajeComision { get; set; }

        [DataMember]
        public virtual ICollection<Orden> OrdenList { get; set; }        

        public Empleado()
        {
            FechaAlta = DateTime.Now;
            OrdenList = new List<Orden>();
        }
    }
}
